bd2e77b2bc4024bc4699c0ba0190c69ec16e6dee,elda-lda/src/main/java/com/epimorphics/lda/sources/SparqlSource.java,SparqlSource,SparqlSource,#Resource#AuthMap#,53
Before Change
if (authKey != null) {
// System.err.println(">> authKey: " + authKey);
// System.err.println(">> authMap: " + am);
ELog.debug(log, "handling auth key '%s'", authKey);
AuthInfo ai = am.get( authKey );
if (ai != null) {
user = ai.get("basic.user");
password = ai.get("basic.password").toCharArray();
}
}
}
//
this.basicUser = user;
this.basicPassword = password;
// System.err.println( ">> basicUser: " + this.basicUser);
// System.err.println( ">> secure: " + secure);
// System.err.println( ">> allowInsecure: " + allowInsecure);
if (this.basicUser != null && !secure && !allowInsecure) {
throw new EldaException
( "This basic-authentication SPARQL endpoint ("
+ sparqlEndpoint + ")\n is insecure (does not use https:)"
+ "\n and authAllowInsecure has not been specified."
);
}
//
ELog.info(log, "created '%s'", this.toString());
}
@Override public QueryExecution execute(Query query) {
After Change
if (ep != null) {
allowInsecure = RDFUtils.getBooleanValue(ep, ELDA_API.authAllowInsecure, false);
//
String authKey = RDFUtils.getStringValue( ep, ELDA_API.authKey, null );
if (authKey != null) {
// System.err.println(">> authKey: " + authKey);
// System.err.println(">> authMap: " + am);
log.debug(ELog.message("handling auth key '%s'", authKey));
AuthInfo ai = am.get( authKey );
if (ai != null) {
user = ai.get("basic.user");
password = ai.get("basic.password").toCharArray();
}
}
}
//
this.basicUser = user;
this.basicPassword = password;
// System.err.println( ">> basicUser: " + this.basicUser);
// System.err.println( ">> secure: " + secure);
// System.err.println( ">> allowInsecure: " + allowInsecure);
if (this.basicUser != null && !secure && !allowInsecure) {
throw new EldaException
( "This basic-authentication SPARQL endpoint ("
+ sparqlEndpoint + ")\n is insecure (does not use https:)"
+ "\n and authAllowInsecure has not been specified."
);
}
//
log.info(ELog.message("created '%s'", this.toString()));
}
@Override public QueryExecution execute(Query query) {